#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char *my_strcpy(char *dest, const char *src);
void move_0(int *arr, int len);
void * my_str_reverse(char *arr);
int main(void)
{
	int a[10] = {0, 1, 2, 3, 4, 0, 9, 91, 0, 21};
	move_0(a, 10);
	for(int i = 0; i < 10; i++){
		printf("%d ", a[i]);
	}
	printf("\n");

	char arr[10] = "asdfghjklo";
	my_str_reverse(arr);
	puts(arr);
	return 0;
}


char *my_strcpy(char *dest, const char *src){
	if(src == NULL || dest == NULL)
		return NULL;
	int i = 0;
	while(src[i] != '\0'){
		dest[i] = src[i];
		i++;
	}
	dest[i] = '\0';
	return dest;
}

void move_0(int *arr, int len){
	int i, j;
	for(i = 0; i < len; i++){
		if(0 == arr[i]){
			for(j = i; j < len - 1; j++){
				arr[j] = arr[j] ^ arr[j + 1];
				arr[j + 1] = arr[j] ^ arr[j + 1];
				arr[j] = arr[j] ^ arr[j + 1];
			}
		}
	}
}

void * my_str_reverse(char *arr){
	if(NULL == arr)
		return NULL;
	int i = 0;
	int j = strlen(arr) - 1;
	while(i < j){
		arr[i] ^= arr[j];
		arr[j] ^= arr[i];
		arr[i] ^= arr[j];
		i++;
		j--;
	}
	return arr;
}
